<template>
    <div>
        <el-row :gutter="20">
            <el-col :span="4" style="margin-left: 500px">
                <div class="grid-content bg-purple">
                    <div class="demo-input-suffix" style="margin-bottom: 20px;margin-top: 20px">
                        <div>待审核员工列表</div>
                    </div>
                </div>
            </el-col>
        </el-row>
        <div v-if="empList&&empList.length>0">
            <el-table
                    stripe
                    :data="empList"
                    style="width: 100%">
<!--                <el-table-column >-->
<!--                    <template slot-scope="props">-->
<!--                        <el-form label-position="left" inline class="demo-table-expand">-->
<!--                            <el-form-item label="员工编号">-->
<!--                                <span>{{ props.row.empno }}</span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="员工真名">-->
<!--                                <span>{{ props.row.realname }}</span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="员工性别">-->
<!--                                <span v-if="props.row.gender==1">男</span>-->
<!--                                <span v-else>女</span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="员工电话">-->
<!--                                <span>{{ props.row.tel }}</span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="服务类别">-->
<!--                                <span>{{ props.row.category }}</span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="账号状态">-->
<!--                                <span v-if="props.row.status==1"><el-tag type="success">正常</el-tag></span>-->
<!--                                <span v-else><el-tag type="danger">禁用</el-tag></span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="身份证号">-->
<!--                                <span>{{ props.row.idcard }}</span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="员工评分">-->
<!--                                <span ><el-tag>{{props.row.score}}</el-tag></span>-->
<!--                            </el-form-item>-->
<!--                            <el-form-item label="员工介绍">-->
<!--                                <span>{{ props.row.introduce }}</span>-->
<!--                            </el-form-item>-->
<!--                        </el-form>-->
<!--                    </template>-->
<!--                </el-table-column>-->
<!--                <el-table-column-->
<!--                        align="center"-->
<!--                        label="员工编号"-->
<!--                        prop="empno">-->
<!--                </el-table-column>-->
                <el-table-column
                        align="center"
                        label="员工真名"
                        prop="realname">
                </el-table-column>
                <el-table-column
                        align="center"
                        label="员工性别"
                        prop="gender">
                    <template  slot-scope="scope">
                        <span v-if="scope.row.status==1">男</span>
                        <span v-else>女</span>
                    </template>
                </el-table-column>
                <el-table-column
                        align="center"
                        label="员工电话"
                        prop="tel">
                </el-table-column>
                <el-table-column
                        align="center"
                        label="服务类别"
                        prop="category">
                </el-table-column>
                <el-table-column
                        align="center"
                        label="账号状态"
                        prop="status">
                    <template>
                        <span><el-tag type="danger">待审核</el-tag></span>
                    </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="180">
                    <template slot-scope="scope">
                        <el-button
                                size="small"
                                type="primary"
                                @click="checkEmp( scope.row)">去审核
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination

                    :page-size="6"
                    :pager-count="5"
                    @current-change="getEmpByPage"
                    layout="prev, pager, next"
                    :total="totalEmp">
            </el-pagination>
        </div>
        <div v-else>
            <el-empty description="尚无待审核员工"></el-empty>
        </div>
    </div>
</template>

<script>
    export default {
        name: "checkEmp",
        data() {
            return {
                searchEmp: [],
                state: '',
                timeout:  null,
                empList:[],     //分页获取的员工列表
                totalEmp:null,   //分页总条数
                tempEmp:'',
            };
        },
        created() {
            this.getEmpByPage(1);
        },
        methods: {
            getEmpByPage(currentPage){
                var that=this;
                this.$ajax.post('/jz/emp/showCheckEmpByPage?currentPage='+currentPage).then(function (resp) {
                    console.log(resp.data);
                    if(resp.data.status==200){
                        that.totalEmp=resp.data.totalCount;
                        that.empList=resp.data.empList;
                    }
                    if(resp.data.status==204){
                        that.empList=resp.data.empList;
                    }
                })
            },

            checkEmp(row) {
                //console.log( row.id);
                this.$router.push({
                    path: '/checkEmpInfo',
                    query:{
                        eid:row.id
                    }
                })

            }
        },

    }
</script>

<style scoped>
    .demo-table-expand {
        font-size: 0;
    }
    .demo-table-expand label {
        width: 90px;
        color: #99a9bf;
    }
    .demo-table-expand .el-form-item {
        margin-right: 0;
        margin-bottom: 0;
        width: 50%;
    }
</style>
